Chat Support
Loupe - Log - Monitor - Resolve
Gibraltar.Agent Namespace / Log Class / Write Method / Write(LogMessageSeverity,String,Int32,Exception,Boolean,LogWriteMode,String,String,String,String,Object[]) Method
The log message severity.
The name of the originating log system (e.g. "Log4Net").
The number of stack frames to skip back over to determine the original caller. (0 means the immediate caller of this method; 1 means their immediate caller, and so on.)
An Exception object to attach to this log message.
True to record this log message based on where the exception was thrown, not where this method was called
Whether to queue-and-return or wait-for-commit.
An XML document (as a string) with extended details about the message. (May be null.)
The application subsystem or logging category that the log message is associated with, which supports a dot-delimited hierarchy.
A simple single-line message caption. (Will not be processed for formatting.)
Additional multi-line descriptive message (or may be null) which can be a format string followed by corresponding args.
A variable number of arguments referenced by the formatted description string (or no arguments to skip formatting).

In This Topic
    Write(LogMessageSeverity,String,Int32,Exception,Boolean,LogWriteMode,String,String,String,String,Object[]) Method
    In This Topic
    Write a complete log message directly to the Loupe log from a wrapper method or bridging logic, attributing the source of the message farther up the call-stack.
    Syntax
    'Declaration
     
    
    Public Overloads Shared Sub Write( _
       ByVal severity As LogMessageSeverity, _
       ByVal logSystem As String, _
       ByVal skipFrames As Integer, _
       ByVal exception As Exception, _
       ByVal attributeToException As Boolean, _
       ByVal writeMode As LogWriteMode, _
       ByVal detailsXml As String, _
       ByVal category As String, _
       ByVal caption As String, _
       ByVal description As String, _
       ByVal ParamArray args() As Object _
    ) 

    Parameters

    severity
    The log message severity.
    logSystem
    The name of the originating log system (e.g. "Log4Net").
    skipFrames
    The number of stack frames to skip back over to determine the original caller. (0 means the immediate caller of this method; 1 means their immediate caller, and so on.)
    exception
    An Exception object to attach to this log message.
    attributeToException
    True to record this log message based on where the exception was thrown, not where this method was called
    writeMode
    Whether to queue-and-return or wait-for-commit.
    detailsXml
    An XML document (as a string) with extended details about the message. (May be null.)
    category
    The application subsystem or logging category that the log message is associated with, which supports a dot-delimited hierarchy.
    caption
    A simple single-line message caption. (Will not be processed for formatting.)
    description
    Additional multi-line descriptive message (or may be null) which can be a format string followed by corresponding args.
    args
    A variable number of arguments referenced by the formatted description string (or no arguments to skip formatting).
    Remarks

    This method provides an advanced use of Loupe log messages for use in wrapper methods and for bridging simple logging systems into Loupe. Also see Verbose and VerboseDetail and their other overloads and related methods for simpler usage of XML details when the other advanced hooks are not needed.

    This overload of Write() is provided as an API hook for simple wrapping methods which need to attribute a log message to their own outer callers rather than to the direct caller of this method. Passing a skipFrames of 0 would designate the caller of this method as the originator; a skipFrames of 1 would designate the caller of the caller of this method as the originator, and so on. It will then extract information about the originator automatically based on the indicated stack frame. Bridge logic adapting from a logging system which already determines and provides information about the originator (such as log4net) into Loupe should use the other overload of Write, passing a customized IMessageSourceProvider.

    This method also requires explicitly selecting the LogWriteMode between Queued (the normal default, for optimal performance) and WaitForCommit (to help ensure critical information makes it to disk, e.g. before exiting the application upon return from this call). See the LogWriteMode enum for more information.

    This method also allows an optional Exception object to be attached to the log message (null for none). It can also include an optional XML document (as a string, or null for none) containing extended details about the message.

    If attributeToException is set to true the log message will be attributed to the location where the provided exception was thrown from instead of the caller of this method.

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also